﻿@using System.Data;
@using Webdiyer.WebControls.Mvc
@using System.Web.Mvc.Ajax;
@using Shop.Entity;
@using Shop.Bll;
@model  PagedList<DataRow>

@{ Layout = null;}

<table class="table table-bordered  table-condensed  table-hover " id="treeTable1">
    <thead>
        <tr>
            <th>品牌</th>
            <th>LOGO</th>
            <th>网址</th>
            <th>显示顺序</th>
            <th>备注</th>
            <th>操作</th>
        </tr>
    </thead>
    <tbody>
        @foreach (var row in Model)
        {
            <tr>
                <td class="title"> @row["Title"]</td>
                <td>
                    <img onmouseover="MouseShowImage(this);" src="@row["Logo"]" style="width:50px;height:21px;" />
                </td>
                <td><a href="@row["Url"]" target="_blank">@row["Url"]</a></td>
                <td>@row["Sort"]</td>
                <td class="remark">
                    <abbr data-toggle="popover" data-placement="top" data-trigger="hover" data-content="@row["Remark"]" data-original-title="@row["Title"]">
                        @row["Remark"]
                    </abbr>
                </td>
                <td>
                    <a title="编辑" class="btn  btn-default btn-xs"
                       onclick="Edit('@row["Guid"]','@row["OperatorGuid"]','@row["Title"]','@row["Logo"]','@row["Url"]','@row["Sort"]','@row["Remark"]');">编辑</a>
                    <a class="btn btn-default btn-xs" title='删除' onclick="Delete('@row["Guid"]','@row["Title"]' )">删除</a>
                </td>
            </tr>
        }
    </tbody>
</table>
<div class="col-xs-10" style="width:auto;padding-left:0px;">
    <input type="hidden" value="@Model.TotalPageCount" id="TotalPageCount" />
    <ul class="pagination">
        <li>
            <span aria-hidden="true">
                @(Model.PageSize)条/页，@(Model.TotalPageCount)页, 共@(Model.TotalItemCount)条
            </span>
        </li>
        <li>
            <span aria-hidden="true">
                每页
                <select style="border-radius:4px;font-family:normal;vertical-align: text-bottom;" id="PageSize" name="PageSize" onchange="PageSizeChange();">
                    <option value="10">10</option>
                    <option value="15">15</option>
                    <option value="20">20</option>
                </select>
                条
            </span>
        </li>
    </ul>
    @Ajax.Pager(Model,
new PagerOptions
{
    Id = "pageItem",
    PageIndexParameterName = "id",
    CssClass = "pagination",
    FirstPageText = "首页",
    LastPageText = "尾页",
    PrevPageText = "上一页",
    PageIndexBoxId = "pageIndexBox",
    NextPageText = "下一页",
    CurrentPagerItemTemplate = "<li class=\"active\"><a data-pageindex=\"{0}\" href=\"/GoodsManage/Brand/List/{0}\">{0}</a></li>",
    DisabledPagerItemTemplate = "<li class=\"disabled\"><a>{0}</a></li>",
    PagerItemTemplate = "<li>{0}</li>",
    AutoHide = false,


}, new MvcAjaxOptions
{
    UpdateTargetId = "divTable",
    HttpMethod = "Post",
    DataFormId = "formSearch",
    EnableHistorySupport = false,
    //EnablePartialLoading=true
    //OnSuccess = "EditMsg",
}
)
</div>
<div class="pagination" style="width:20%;margin-top: 0px;">
    <ul class="pagination">
        <li>
            <div class="input-group">
                <span class="input-group-addon" id="sizing-addon2">第</span>
                @*<select id="pageIndexBox" class="form-control input-sm"> </select>*@
                <input type="text" id="pageIndexBox" class="form-control input-sm" placeholder="" aria-describedby="sizing-addon2">
                <span class="input-group-addon">页</span>
                <span class="input-group-btn">
                    <button class="btn btn-primary btn-sm" type="button" id="goBtn">Go</button>
                </span>
            </div>
        </li>
    </ul>
</div>
<script type="text/javascript">
    var txt = $("#SearchTitle").val().trim();
    if (txt.length > 0)
    {
        $(".title").each(function ()
        {
            var newTxt = $(this).html().replace(txt, txt.fontcolor("red"));
            $(this).html(newTxt);
        });
    }
    $("input[name='PageSize']").val('@ViewData["NowPageSize"]');
    $("#PageSize").val(@ViewData["NowPageSize"]);
    $('[data-toggle="popover"]').popover();


    $("#goBtn").click(function () {
        var pager = Webdiyer.MvcPagers[0];
        if (pager != null) {
            pager.goToPage($("#pageIndexBox").val());
        } else { alert("找不到指定的MvcPager！"); }
    });
</script>